ass Solution {
public:
    vector<string> findWords(vector<string>& words) {
        //0 1 2 来记录是在第几行的
        vector<string> ret;
        int flag = 0;
        string s_one("qwertyuiop");
        string s_two("asdfghjkl");
        string s_three("zxcvbnm");
        //e不用& 因为先全部转成小写
        //再cout原来的数据
        for(auto word:words)
        {
            string tmp = word;
            transform(word.begin(),word.end(),word.begin(),::tolower);
            //每个字符串
            for(int i=0;i<word.size();i++)
            {
                if(word.size()==1)
                {
                    ret.push_back(word);
                    break;
                }
                //每个字符串中的字符
                //先判断是第几行的，不同行是要 false的
                if(i==0 && s_one.find(word[i])!=string::npos)
                {
                    flag = 0;
                    //这里跳过是为了直接去 i=1 开始
                    continue;
                }
                else if(i==0 && s_two.find(word[i])!=string::npos)
                {
                    flag = 1;
                    continue;
                }
                else if(i==0 && s_three.find(word[i])!=string::npos)
                {
                    flag = 2;
                    continue;
                }

                if(flag==0 && (s_two.find(word[i])!=string::npos||
                s_three.find(word[i])!=string::npos))
                {   //发现有不是一行的，直接跳过word（此字符串）
                    break;
                }
                else if(flag==1 && (s_one.find(word[i])!=string::npos||
                s_three.find(word[i])!=string::npos))
                {
                    break;
                }
                else if(flag==2 && (s_one.find(word[i])!=string::npos||
                s_two.find(word[i])!=string::npos))
                {
                    break;
                }

                if(i==word.size()-1)
                {
                    ret.push_back(tmp);
                }
            }
        }
        return ret;
    }
};

ass Solution {
public:
    int numJewelsInStones(string jewels, string stones) {
        set<char> set_jewels;
        int ret=0;
        for(auto &e:jewels)
        {
            set_jewels.insert(e);
        }
        for(auto &e:stones)
        {
            if (set_jewels.find(e) != set_jewels.end())
            {
                ret++;
            }
        }
        return ret;
    }
};

